<?php

namespace App\Modules\Admin\Entities\Water;

use App\Models\Model;

class WaterWithUserModel extends Model
{
    protected $table = 'water_with_user';
    protected $primaryKey = 'with_id';

    public function getUserWithWaterByIds($user_id){
        $list = $this->where(['user_id'=>$user_id,'is_delete'=>0])->get()->toArray();
        return array_column($list,'water_role','water_id');
    }
    public function getUserWithWaterByUserIds($user_ids){
        $list = $this->where(['is_delete'=>0])->whereIn('user_id',$user_ids)->get()->toArray();

        return array_column($list,'user_id','water_id');
    }
}
